<?php

use think\facade\Route;

Route::miss(function () {
    return \think\facade\View::fetch(app()->getBasePath() . '/error/empty.html', [
        'msg' => '没有匹配到正确路由：' . request()->url(),
    ]);
});

//首页
Route::get('/', 'index/index')->middleware('verify');

//上传
Route::group('uploads', function () {
    Route::rule('/uploadImage', 'uploads/uploadImage');
    Route::rule('/uploadImageMaterial', 'uploads/uploadImageMaterial');
    Route::rule('/uploadEditorVideo', 'uploads/uploadEditorVideo');
})->ext('html');

//定时测试
Route::group('test', function () {
    $graft = '\addons\Builder\driver\TableTool@';
    Route::get('/index', $graft . 'test');
    Route::post('/execute', $graft . 'execute');
})->middleware('verify')->ext('html');

//主题
Route::group('theme', function () {
    $graft = '\addons\Builder\driver\Theme@';
    Route::get('/h5', $graft . 'h5');
    Route::post('/cover', $graft . 'cover');
})->middleware('verify')->ext('html');


Route::group('index', function () {
    Route::get('/index', 'index/index');
    Route::get('/welcome', 'index/welcome');
    Route::post('/getweburl', 'index/getweburl');
    Route::post('/setSetting', 'index/setSetting');
    Route::get('/getSetting', 'index/getSetting');
    Route::post('/clearCache', 'index/clearCache');
})->middleware('verify')->ext('html');

//登录
Route::group('login', function () {
    Route::get('/index', 'login/index');
    Route::post('/login', 'login/login');
    Route::post('/logout', 'login/logout');
})->ext('html');

//我的桌面
Route::group('desktop', function () {
    Route::get('/index', 'desktop/statistics');
})->middleware('verify')->ext('html');

//会员管理
Route::group('user', function () {
    Route::get('/ordinary', 'user/ordinary');
    Route::get('/formal', 'user/formal');
    Route::get('/add', 'user/add');
    Route::get('/edit', 'user/edit');
    Route::post('/reset', 'user/reset');
    Route::post('/save', 'user/save');
    Route::post('/login', 'user/login');
    Route::get('/export', 'user/export');
    Route::get('/getList', 'user/getList');
    Route::get('/login', 'user/login');
    Route::post('/update', 'user/update');
    Route::post('/delete', 'user/delete');
})->middleware('verify');

//新闻公告
Route::group('news', function () {
    Route::get('/index', 'news/index');
    Route::get('/getList', 'news/getList');
    Route::get('/add', 'news/add');
    Route::get('/edit', 'news/edit');
    Route::get('/export', 'news/export');
    Route::post('/save', 'news/save');
    Route::post('/update', 'news/update');
    Route::post('/delete', 'news/delete');
})->middleware('verify');

//轮播管理
Route::group('carousel', function () {
    Route::get('/index', 'carousel/index');
    Route::get('/getList', 'carousel/getList');
    Route::get('/add', 'carousel/add');
    Route::get('/edit', 'carousel/edit');
    Route::post('/save', 'carousel/save');
    Route::post('/update', 'carousel/update');
    Route::post('/delete', 'carousel/delete');
})->middleware('verify');


//留言管理
Route::group('message', function () {
    Route::get('/index', 'message/index');
    Route::get('/getList', 'message/getList');
    Route::get('/add', 'message/add');
    Route::get('/edit', 'message/edit');
    Route::post('/save', 'message/save');
})->middleware('verify');


//菜单管理
Route::group('menu', function () {
    Route::get('/index', 'menu/index');
    Route::get('/getList', 'menu/getList');
    Route::get('/add', 'menu/add');
    Route::get('/edit', 'menu/edit');
    Route::post('/save', 'menu/save');
    Route::get('/updateStatus', 'menu/updateStatus');
    Route::rule('/update', 'menu/update');
    Route::post('/delete', 'menu/delete');
})->middleware('verify');


//网站配置
Route::group('config', function () {
    Route::get('/index', 'config/index');
    Route::get('/getList', 'config/getList');
    Route::get('/add', 'config/add');
    Route::get('/edit', 'config/edit');
    Route::post('/save', 'config/save');
    Route::post('/update', 'config/update');
    Route::post('/delete', 'config/delete');
    Route::get('/create', 'config/create');
    Route::post('/saveGroup', 'config/saveGroup');
})->middleware('verify');

//角色管理
Route::group('role', function () {
    Route::get('/index', 'role/index');
    Route::get('/getList', 'role/getList');
    Route::get('/add', 'role/add');
    Route::get('/edit', 'role/edit');
    Route::post('/save', 'role/save');
    Route::post('/update', 'role/update');
    Route::post('/delete', 'role/delete');
    Route::rule('/give', 'role/give');
})->middleware('verify');

//用户列表
Route::group('admin', function () {
    Route::get('/index', 'admin/index');
    Route::get('/getList', 'admin/getList');
    Route::get('/add', 'admin/add');
    Route::get('/edit', 'admin/edit');
    Route::post('/save', 'admin/save');
    Route::post('/update', 'admin/update');
    Route::post('/delete', 'admin/delete');
    Route::rule('/password', 'admin/password');
})->middleware('verify');


//数据管理
Route::group('backup', function () {
    Route::get('/index', 'backup/index');
    Route::get('/add', 'backup/add');
    Route::get('/import', 'backup/import');
    Route::get('/clear', 'backup/clear');
    Route::get('/backup', 'backup/delete');
})->middleware('verify');

//操作日志
Route::group('logs', function () {
    Route::get('/index', 'logs/index');
    Route::get('/getList', 'logs/getList');
    Route::get('/queryIp', 'logs/queryIp');
})->middleware('verify');


//插件管理
Route::group('addons', function () {
    Route::get('/index', '\addons\Plugin@index');
    Route::get('/getList', '\addons\Plugin@getList');
    Route::post('/install', '\addons\Plugin@install');
    Route::post('/uninstall', '\addons\Plugin@uninstall');
    Route::post('/locking', '\addons\Plugin@locking');
    Route::post('/update', '\addons\Plugin@update');
})->middleware('verify')->ext('html');

//课程管理
Route::group('cate', function () {
    Route::get('/index', 'cate/index');
    Route::get('/getList', 'cate/getList');
    Route::get('/add', 'cate/add');
    Route::get('/edit', 'cate/edit');
    Route::get('/edit_cate', 'cate/edit_cate');
    Route::post('/save', 'cate/save');
    Route::post('/saveCate', 'cate/saveCate');
    Route::post('/update', 'cate/update');
    Route::post('/delete', 'cate/delete');
})->middleware('verify');//报名管理
Route::group('signup', function () {
    Route::get('/index', 'signup/index');
    Route::get('/getList', 'signup/getList');
    Route::get('/add', 'signup/add');
    Route::get('/edit', 'signup/edit');
    Route::post('/save', 'signup/save');
    Route::post('/update', 'signup/update');
    Route::post('/delete', 'signup/delete');
})->middleware('verify');//视频中心
Route::group('learn', function () {
    Route::get('/index', 'learn/index');
    Route::get('/getList', 'learn/getList');
    Route::get('/add', 'learn/add');
    Route::get('/edit', 'learn/edit');
    Route::post('/save', 'learn/save');
    Route::post('/update', 'learn/update');
    Route::post('/delete', 'learn/delete');
})->middleware('verify');//课程列表
Route::group('course', function () {
    Route::get('/index', 'course/index');
    Route::get('/getList', 'course/getList');
    Route::get('/add', 'course/add');
    Route::get('/edit', 'course/edit');
    Route::post('/save', 'course/save');
    Route::post('/update', 'course/update');
    Route::post('/delete', 'course/delete');
})->middleware('verify');//课程章节
Route::group('courseChapter', function () {
    Route::get('/index', 'courseChapter/index');
    Route::get('/getList', 'courseChapter/getList');
    Route::get('/add', 'courseChapter/add');
    Route::get('/edit', 'courseChapter/edit');
    Route::post('/save', 'courseChapter/save');
    Route::post('/update', 'courseChapter/update');
    Route::post('/delete', 'courseChapter/delete');
})->middleware('verify');//题库列表
Route::group('exam', function () {
    Route::get('/index', 'exam/index');
    Route::get('/getList', 'exam/getList');
    Route::get('/getExamList', 'exam/getExamList');
    Route::get('/add', 'exam/add');
    Route::get('/edit', 'exam/edit');
    Route::post('/save', 'exam/save');
    Route::post('/update', 'exam/update');
    Route::post('/delete', 'exam/delete');
    Route::post('/importInfo', 'exam/importInfo');
})->middleware('verify');//考卷管理
Route::group('paper', function () {
    Route::get('/index', 'paper/index');
    Route::rule('/add_paper', 'paper/add_paper');
    Route::get('/getList', 'paper/getList');
    Route::get('/add', 'paper/add');
    Route::get('/edit', 'paper/edit');
    Route::post('/save', 'paper/save');
    Route::post('/update', 'paper/update');
    Route::post('/delete', 'paper/delete');
})->middleware('verify');//考试列表
Route::group('examine', function () {
    Route::get('/index', 'examine/index');
    Route::get('/getList', 'examine/getList');
    Route::get('/examineList', 'examine/examineList');
    Route::get('/getExamineList', 'examine/getExamineList');
    Route::get('/paper', 'examine/paper');
    Route::get('/getUser', 'examine/getUser');
    Route::get('/add', 'examine/add');
    Route::get('/edit', 'examine/edit');
    Route::post('/save', 'examine/save');
    Route::post('/update', 'examine/update');
    Route::post('/delete', 'examine/delete');
})->middleware('verify');//视频分类
Route::group('videoCate', function () {
    Route::get('/index', 'videoCate/index');
    Route::get('/getList', 'videoCate/getList');
    Route::get('/add', 'videoCate/add');
    Route::get('/edit', 'videoCate/edit');
    Route::post('/save', 'videoCate/save');
    Route::post('/update', 'videoCate/update');
    Route::post('/delete', 'videoCate/delete');
})->middleware('verify');//考试考题
Route::group('paperBank', function () {
    Route::get('/index', 'paperBank/index');
    Route::get('/getList', 'paperBank/getList');
    Route::get('/add', 'paperBank/add');
    Route::get('/edit', 'paperBank/edit');
    Route::post('/save', 'paperBank/save');
    Route::post('/update', 'paperBank/update');
    Route::post('/delete', 'paperBank/delete');
})->middleware('verify');